for _ in range(int(input())):
n = int(input())
l = list(map(int,input().split()))
l = 10 - n;
ans = 6*l*(l-1)
print(ans//2)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1000010;
int a[N];
int fact[N],infact[N];
int power(int a,int b)
{
int ans = 1;
while (b)
{
if (b & 1) ans = (ll)ans * a ;
b >>= 1;
a = (ll)a * a ;
}
return ans;
}
void cf()
{
ll n;
map<int,int>mp;
cin>>n;
ll cnt=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
mp[a[i]]++;
}
for(int i=0;i<=9;i++)if(mp[i]==0)cnt++;//统计有多少个数字没有用
cout<<cnt*(cnt-1)/2*6<<endl;
}
int main()
{
ll t;
cin>>t;
while(t--)
{
cf();
}
return 0;
}
1684A - Digit Minimization | 43B - Letter |
1017A - The Rank | 1698B - Rising Sand |
235A - LCM Challenge | 1075B - Taxi drivers and Lyft |
1562A - The Miracle and the Sleeper | 1216A - Prefixes |
1490C - Sum of Cubes | 868A - Bark to Unlock |
873B - Balanced Substring | 1401D - Maximum Distributed Tree |
1716C - Robot in a Hallway | 1688B - Patchouli's Magical Talisman |
99A - Help Far Away Kingdom | 622B - The Time |
1688C - Manipulating History | 1169D - Good Triple |
1675B - Make It Increasing | 588A - Duff and Meat |
1541B - Pleasant Pairs | 1626B - Minor Reduction |
1680A - Minimums and Maximums | 1713A - Traveling Salesman Problem |
1713B - Optimal Reduction | 1710A - Color the Picture |
1686B - Odd Subarrays | 251A - Points on Line |
427C - Checkposts | 1159A - A pile of stones |